package org.acompanhamento.domain;

import static javax.persistence.FetchType.LAZY;

import java.util.Collections;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import jmine.tec.aom.domain.Property;
import jmine.tec.persist.annotation.Alias;
import jmine.tec.persist.annotation.Index;

import org.hibernate.validator.NotNull;

import bancosys.tec.component.Documentation;
import bancosys.tec.persist.persister.annotation.NaturalKey;

@Entity
@Table(name = "STATUS_TRANSICTION")
@Alias("STTRAN")
@Documentation("STATUS TRANSICTION")
@SequenceGenerator(name = "SEQ_STATUS_TRANSICTION", sequenceName = "SEQ_STATUS_TRANSICTION")
public class StatusTransiction  extends PropertizedEntity {

	private Long id;

	private String name;

	private Status fromStatus;

	private Status toStatus;

	@Id
	@GeneratedValue(generator = "SEQ_STATUS_TRANSICTION")
	@Column(name = "COD_STATUS_TRANSICTION", nullable = false)
	@Documentation("STATUS TRANSICTION ID")
	public Long getId() {
		return this.id;
	}

	@NaturalKey
	@Index(suffix = "0")
	@NotNull
	@Column(name = "NAME", nullable = false)
	@Documentation("NAME")
	public String getName() {
		return this.name;
	}

	@ManyToOne(fetch = LAZY)
	@NotNull
	@JoinColumn(name = "COD_FROM_STATUS", nullable = false)
	@Documentation("FROM STATUS ID")
	public Status getFromStatus() {
		return this.fromStatus;
	}

	@ManyToOne(fetch = LAZY)
	@NotNull
	@JoinColumn(name = "COD_TO_STATUS", nullable = false)
	@Documentation("TO STATUS ID")
	public Status getToStatus() {
		return this.toStatus;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setFromStatus(Status fromStatus) {
		this.fromStatus = fromStatus;
	}

	public void setToStatus(Status toStatus) {
		this.toStatus = toStatus;
	}

	@Override
	@Transient
	protected Set<Property> getEntityProperties() {
		return Collections.emptySet();
	}
}
